//
//  HLEToastHelper.m
//  HLETips
//
//  Created by hle1 on 2020/5/22.
//

#import "HLEToastHelper.h"

@implementation HLEToastHelper
NSString *const kResourcesBundleName = @"HLETips";

+ (UIImage *)imageWithName:(NSString *)name {
    static NSBundle *resourceBundle = nil;
    if (!resourceBundle) {
        NSBundle *mainBundle = [NSBundle bundleForClass:self];
        NSString *resourcePath = [mainBundle pathForResource:kResourcesBundleName ofType:@"bundle"];
        resourceBundle = [NSBundle bundleWithPath:resourcePath] ?: mainBundle;
    }
    UIImage *image = [UIImage imageNamed:name inBundle:resourceBundle compatibleWithTraitCollection:nil];
    return image;
}

+ (NSBundle *)getCurentBundle
{
    static NSBundle *resourceBundle = nil;
    NSBundle *mainBundle = [NSBundle bundleForClass:self];
    NSString *resourcePath = [mainBundle pathForResource:kResourcesBundleName ofType:@"bundle"];
    resourceBundle = [NSBundle bundleWithPath:resourcePath] ?: mainBundle;
    return resourceBundle;
}
@end
